#include <iostream>
#include "sort.h"

int main()
{
    int n, *arr = nullptr;

    std::cout << "Enter the number of elements: " << std::endl;
    std::cin >> n;

    if (n <= 0)
    {
        std::cout << "Invalid input" << std::endl;
        return 1;
    }

    arr = new int[n];

    std::cout << "Enter the elements: " << std::endl;
    for (int i = 0; i < n; i++)
    {
        std::cin >> arr[i];
    }

    std::cout << "The array is: ";
    for (int i = 0; i < n; i++)
    {
        std::cout << arr[i] << "\t";
    }

    bubbleSort(arr, n);

    std::cout << "\nThe sorted array is: ";
    for (int i = 0; i < n; i++)
    {
        std::cout << arr[i] << "\t";
    }
    std::cout << std::endl;

    delete[] arr;
    system("pause");
    return 0;
}
